package com.fivetiger.service.impl;

import com.fivetiger.dao.ContractDao;
import com.fivetiger.dao.OrderDao;
import com.fivetiger.dto.ContractDto;
import com.fivetiger.dto.OrderDto;
import com.fivetiger.entity.Contract;
import com.fivetiger.entity.Order;
import com.fivetiger.service.inte.ContractService;
import com.fivetiger.service.inte.OrderService;
import com.fivetiger.util.RUtil;
import com.fivetiger.vo.PageBean;
import com.fivetiger.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrderServiceImpl implements OrderService {
    @Autowired
    private OrderDao dao;

    @Override
    public R save(Order order) {
        if (order != null){
            if (dao.insert(order) > 0){
                return RUtil.ok();
            }
        }
        return RUtil.fail();
    }

    @Override
    public PageBean query() {
        List<OrderDto> list = dao.select();
        return new PageBean(0,"",list.size(),list);
    }
}
